#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <typeinfo> 
#include <vector> 
#include "pugixml.hpp"
using  namespace std;
int main(int argc, char **argv)
{
    pugi::xml_document doc;
    pugi::xml_parse_result result = doc.load_file("service_config.xml",pugi::parse_default,pugi::encoding_utf8);
    if(!result) {
        std::cout<<"load result "<<result.description()<<std::endl;
        std::cout<<result.offset<<std::endl;
        return -1;
    }
    pugi::xml_node root = doc.child("service_config");
    std::cout<<root.parent().parent().type()<<std::endl;
    for(pugi::xml_node service = root.child("service_list"); service; service = service.next_sibling("service_list"))
    {
        for(pugi::xml_node node = service.first_child(); node; node = node.next_sibling())
        {
            std::cout<<node.name()<<"->"<<node.child_value()<<std::endl;
        }
    }
    std::cout<<"-----------------------"<<std::endl;

    for (const auto& service : root.children("service_list")) { 
        for (const auto& node : service.children()) { 
            std::cout<<node.name()<<"->"<<node.child_value()<<"-------"<<node.text().get()<<std::endl;
        } 
    } 

/*    doc.print(std::cout);*/
    std::string str;
    printf("%s  %s\n", typeid(std::string).name(), typeid(str).name());
    printf("%s  %s\n", typeid(vector<int>).name(), typeid(vector<std::string>).name());
    if (typeid(std::vector<int>) == typeid(std::vector<char>)) printf("yes\n");

    return 0;
}
